package com.smart.controller;

import com.smart.common.WebResponse;
import com.smart.common.annotation.WebAccess;
import com.smart.common.PageInfo;
import com.smart.model.request.ProjectFileTaskInstanceRequest;
import com.smart.service.ProjectFileTaskInstanceService;
import com.smart.model.vo.ProjectFileTaskInstanceVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;
import java.util.List;

/**
 * @author zhanghong
 */
@RestController
@RequestMapping("/instance")
@Api(value = "项目文件任务实例模块", tags = {"【云服务端】项目文件任务实例模块"})
public class ProjectFileTaskInstanceController {

    @Autowired
    private ProjectFileTaskInstanceService projectFileTaskInstanceService;

    @WebAccess(login = true)
    @ApiOperation("分页查询")
    @PostMapping("/pageQuery")
    public WebResponse<PageInfo<ProjectFileTaskInstanceVO>> pageQuery(@RequestBody ProjectFileTaskInstanceRequest request) {
        return WebResponse.build(projectFileTaskInstanceService.pageQuery(request));
    }

    @WebAccess(login = true)
    @ApiOperation("已接收")
    @PostMapping("/receive/{id}")
    public WebResponse<Boolean> receive(@PathVariable("id") long id) {
        return WebResponse.build(projectFileTaskInstanceService.receive(id));
    }
}
